package com.zhiyou.app.pojo.enums;


import com.google.gson.annotations.SerializedName;

import java.util.Arrays;

/**
 * @Description 提现状态
 * @Author : bind
 * @Date : 2022-06-14 14:41
 */
public enum WithdrawalStatusEnum {
    CREATE("CREATE", "创建"),
    PROCESSING("PROCESSING", "转账锁定资金中"),
    ACCEPTED("ACCEPTED", "已受理"),
    WAIT_USER_CONFIRM("WAIT_USER_CONFIRM", "等待用户确认"),
    TRANSFERING("TRANSFERING", "转款中"),
    SUCCESS("SUCCESS", "成功"),
    FAIL("FAIL", "失败"),
    CANCELING("CANCELING", "取消中"),
    CANCELLED("CANCELLED", "已取消");

    public String code;
    public String name;

    WithdrawalStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static boolean contains(String s) {
        return Arrays.stream(WithdrawalStatusEnum.values()).map(WithdrawalStatusEnum::toString).anyMatch(s::equals);
    }

    @Override
    public String toString() {
        return String.valueOf(this.code);
    }

    public static WithdrawalStatusEnum parse(String code) {
        return Arrays.stream(WithdrawalStatusEnum.values()).filter(s -> s.code.equals(code)).findFirst().orElse(null);
    }
}
